<?php

/**
 * Abstraction pour les classes prenant en charge les elements de template
 *
 * @category   McCube
 * @package    Template\Parser\Element
 * @author     Leiha Sellier <leiha.sellier@gmail.com>
 * @license    http://creativecommons.org/licenses/by/3.0/  CC BY 3.0
 * @link       http://code.google.com/p/mechanics-cubes/
 */
abstract class McCube_Template_Parser_Element_Abstract{

    protected $parser  = null;
    protected $_phpTags = true;

    public function __construct($parser){
        $this->parser = $parser;
    }

    protected function _addExecListener($content){
        $id = McCube_Template_Parser::addExecListener();
        return '<!- START EXECUTION '.$id.' -->'."\n"
            .$content
            ."\n".'<!- END EXECUTION '.$id.' -->'
        ;
    }

    public function buildPhpTag($string){
        if(!$this->_phpTags)
            return $string;

        $string = '<?php '.$string.' ?>';
        return $string;
    }


}